# 指定 CMake 最低版本
cmake_minimum_required(VERSION 3.10)

project(ChatServer)

set(srcs ../global/commonFunc/terminal.cpp 
        ui/src/serverUi.cpp 
        networkManager/src/tcpServer.cpp 
        config/src/serverConfig.cpp 
        dataManager/src/dataManager.cpp 
        dataManager/src/userManager.cpp 
        app/main.cpp)

# 设置 C++17
set(CMAKE_CXX_STANDARD 17)

# 添加 C++ 编译参数
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

include_directories(ui/include)
include_directories(networkManager/include)
include_directories(dataManager/include)
include_directories(config/include)
include_directories(../messageCenter/include)

file(COPY resource/sys.json DESTINATION ${EXECUTABLE_OUTPUT_PATH})

# 生成可执行程序
add_executable(server ${srcs})
link_libraries(${LIBRARY_OUTPUT_PATH})
target_link_libraries(server messageCenter)

# https://wenku.baidu.com/view/9db9e631a11614791711cc7931b765ce05087afa.html